#include<stdio.h>
 
void swap(int *a,int *b)//按地址传递
{    
	int temp=0;
	temp=*a;    //地址取值
	*a=*b;
	*b=temp;
}
 
int main()
{
	int a=3,b=4;
	printf("交换前a=%d,b=%d\n",a,b);//a=3,b=4
	swap(&a,&b);                    //传入了地址
	printf("交换后a=%d,b=%d\n",a,b);//a=4,b=3
	return 0;
}